package com.chapter10;

import java.util.List;

public class TreesMain {
	public static void main(String[] args) {
		
		int[] arr={-90,-45,-12,-3,-3,-2,0,1,1,3,5,7,8,9,12,14,15,16,19,22,29,30,31,34,35};
		BinarySearchTree tree=new BinarySearchTree(arr);
		System.out.println(tree.isBST());
		//System.out.println(tree.testDelete());
		tree.inOrderTraversalIterative();
		System.out.println();
		tree.preOrderTraversalIterative();
		System.out.println();
		tree.postOrderTraversalIterative();
		BinaryTree btree = new BinaryTree();
		/*int[] in={11,4,3,14,7,1,10,2,8};
		int[] level={7,4,2,11,14,1,8,3,10};*/
		/*int[] in={13,16,12,15,1,14,3,11,6,4,5,7,2,20,22,21,17,19,23};
		int[] level={7,3,2,1,6,17,12,14,11,4,20,19,13,15,5,21,23,16,22};
		Tnode r=btree.getBTfromInandLevel(in, level);
		btree.levelOrderTraversal2(r);*/
		//System.out.println(tree.getClosestValue(tree.root, 25).value);
		NodePair p=tree.twoSum(tree.root,0);
		//System.out.println("the values are ="+p.first.value+" and "+p.second.value);
		//List<Integer> l=tree.findKClosestNodes(tree.root,-46,9);
		//System.out.println(l + " size ="+l.size());
		
		//System.out.println(tree.findMinDepthPost(tree.root));
		//System.out.println(tree.findMaxDepthPost(tree.root));
		//System.out.println(tree.checkBalancedPost(tree.root));
		//tree.levelOrderTraversal2(tree.root);
		//System.out.println(tree.getSum(tree.root, 0, 19));
		int in[] = {0,1,0,1};
		int[] level={1,0,0,1};
		//btree.getBTfromInandLevel(in, level);
		//btree.levelOrderTraversal2(btree.root);
		//System.out.println(btree.root);
		tree.inOrderTraversalIterative(tree.root);
		System.out.println();
		tree.postOrderTraversal(tree.root);
		System.out.println();
		tree.postOrderTraversalInterative(tree.root);
		String[] pre={"1","2","3","null","null","4","5","null","null","null","6","null","7","null","8","9","null","null","null"};
		tree.preOrderTraversalwithNulls(pre);
	}
}
